﻿@model AuditWeb.Models.LogOnModel

@{
    ViewBag.Title = AuditResources.UI.PageTitle;
}

<h2>登录</h2>
<p>
    请输入用户名和密码<!--，如果没有账号请 @Html.ActionLink("注册", "Register", null, new { Class = "button" })-->.
</p>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@Html.ValidationSummary(true, "Login was unsuccessful. Please correct the errors and try again.")

@using (Html.BeginForm()) {
    <div>
        <fieldset>
            <legend>账号信息</legend>

            <div class="editor-label">
                @Html.LabelFor(m => m.UserName)
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(m => m.UserName)
                @Html.ValidationMessageFor(m => m.UserName)
            </div>

            <div class="editor-label">
                @Html.LabelFor(m => m.Password)
            </div>
            <div class="editor-field">
                @Html.PasswordFor(m => m.Password)
                @Html.ValidationMessageFor(m => m.Password)
            </div>

            <div class="editor-label-long">
                @Html.CheckBoxFor(m => m.RememberMe)
                @Html.LabelFor(m => m.RememberMe)
            </div>

            <p>
                <input type="submit" value="登录" /><div id="downloadie"></div>
            </p>
        </fieldset>
    </div>
}


<script type="text/javascript">
    function getInternetExplorerVersion()
    // Returns the version of Internet Explorer or a -1
    // (indicating the use of another browser).
    {
        var rv = -1; // Return value assumes failure.
        if (navigator.appName == 'Microsoft Internet Explorer') {
            var ua = navigator.userAgent;
            var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
            if (re.exec(ua) != null)
                rv = parseFloat(RegExp.$1);
        }
        return rv;
    }
    function checkVersion() {
        var msg = "You're not using Internet Explorer.";
        var ver = getInternetExplorerVersion();
        var expectedver = 8.0;

        if (ver > -1) {
            if (ver >= expectedver)
                msg = "You're using a recent copy of Internet Explorer."
            else {
                alert("您的浏览器版本较低，建议使用IE8.0以上浏览器。");
                $('#downloadie').html("您的浏览器版本较低，建议升级到版本的IE浏览器。<a href='http://windows.microsoft.com/zh-CN/internet-explorer/downloads/ie' target='blank'>点击此处查看并下载安装最新IE浏览器</a>");
            }
        }
        
    }
    checkVersion();

</script>
